<?php
class Exts_Form extends Zend_Form
{

    /**
     * Remove all decorators from the form
     */
    public function removeAllDecorator()
    {
    	foreach( $this->getElements() as $e ) {
        	$e->removeDecorator( 'HtmlTag' );
        	$e->removeDecorator( 'Label' );
        	$e->removeDecorator( 'Description' );
        	$e->removeDecorator( 'DtDdWrapper' );
        	$e->removeDecorator( 'Tooltip' );
		}
    }


    /**
     * get All element from this form and set html class for un type element or All types
     * @param string $type
     * @param string $class html class name
     */
    public function setClassToElement( $type, $class )
    {
        $zendFormElementObject = 'Zend_Form_Element_' . ucfirst( $type );
        foreach( $this->getElements() as $e ) {
            if( $e instanceof $zendFormElementObject || $type == 'all') {
                $attribs = $e->getAttribs();
                $attribs['class'] = $class;
                $e->setAttribs( $attribs);
            }
            
        }
    }
}